package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchPressureAverageReports;
import com.ruoyi.system.service.IDispatchPressureAverageReportsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 压力均值报Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchPressureAverageReports")
public class DispatchPressureAverageReportsController extends BaseController
{
    @Autowired
    private IDispatchPressureAverageReportsService dispatchPressureAverageReportsService;

    /**
     * 查询压力均值报列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAverageReports:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchPressureAverageReports dispatchPressureAverageReports)
    {
        startPage();
        List<DispatchPressureAverageReports> list = dispatchPressureAverageReportsService.selectDispatchPressureAverageReportsList(dispatchPressureAverageReports);
        return getDataTable(list);
    }

    /**
     * 导出压力均值报列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAverageReports:export')")
    @Log(title = "压力均值报", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchPressureAverageReports dispatchPressureAverageReports)
    {
        List<DispatchPressureAverageReports> list = dispatchPressureAverageReportsService.selectDispatchPressureAverageReportsList(dispatchPressureAverageReports);
        ExcelUtil<DispatchPressureAverageReports> util = new ExcelUtil<DispatchPressureAverageReports>(DispatchPressureAverageReports.class);
        util.exportExcel(response, list, "压力均值报数据");
    }

    /**
     * 获取压力均值报详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAverageReports:query')")
    @GetMapping(value = "/{pressureAverageReportsId}")
    public AjaxResult getInfo(@PathVariable("pressureAverageReportsId") Long pressureAverageReportsId)
    {
        return success(dispatchPressureAverageReportsService.selectDispatchPressureAverageReportsByPressureAverageReportsId(pressureAverageReportsId));
    }

    /**
     * 新增压力均值报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAverageReports:add')")
    @Log(title = "压力均值报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchPressureAverageReports dispatchPressureAverageReports)
    {
        return toAjax(dispatchPressureAverageReportsService.insertDispatchPressureAverageReports(dispatchPressureAverageReports));
    }

    /**
     * 修改压力均值报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAverageReports:edit')")
    @Log(title = "压力均值报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchPressureAverageReports dispatchPressureAverageReports)
    {
        return toAjax(dispatchPressureAverageReportsService.updateDispatchPressureAverageReports(dispatchPressureAverageReports));
    }

    /**
     * 删除压力均值报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureAverageReports:remove')")
    @Log(title = "压力均值报", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pressureAverageReportsIds}")
    public AjaxResult remove(@PathVariable Long[] pressureAverageReportsIds)
    {
        return toAjax(dispatchPressureAverageReportsService.deleteDispatchPressureAverageReportsByPressureAverageReportsIds(pressureAverageReportsIds));
    }
}
